<?php
if (!isset($_GET['action'])) $action=NULL; else $action=$_GET['action'];
if ($action==NULL) if (!isset($_POST['action'])) $action=NULL; else $action=$_POST['action'];
if (!isset($_GET['product_id'])) $product_id=NULL; else $product_id=$_GET['product_id'];
if ($product_id==NULL) if (!isset($_POST['product_id'])) $product_id=NULL; else $product_id=$_POST['product_id'];
if (!isset($_GET['product_count'])) $product_count=NULL; else $product_count=$_GET['product_count'];
if ($product_count==NULL) if (!isset($_POST['product_count'])) $product_count=NULL; else $product_count=$_POST['product_count'];

if (!isset($_GET['new_user'])) $new_user=NULL; else $new_user=$_GET['new_user'];
if ($new_user==NULL) if (!isset($_POST['new_user'])) $new_user=NULL; else $new_user=$_POST['new_user'];
if (!isset($_GET['new_pass1'])) $new_pass1=NULL; else $new_pass1=$_GET['new_pass1'];
if ($new_pass1==NULL) if (!isset($_POST['new_pass1'])) $new_pass1=NULL; else $new_pass1=$_POST['new_pass1'];
if (!isset($_GET['new_pass2'])) $new_pass2=NULL; else $new_pass2=$_GET['new_pass2'];
if ($new_pass2==NULL) if (!isset($_POST['new_pass2'])) $new_pass2=NULL; else $new_pass2=$_POST['new_pass2'];

switch ($action) {
	case 'clear':
		$shopcartclass->ClearCart(session_id());
		break;
	case 'remove':
		$shopcartclass->RemoveCart(session_id(), $product_id);
		break;
	case 'add':
		$shopcartclass->AddCart(session_id(), $product_id, $product_count);
		break;
	case 'order_send_not_login':
		$shopcartclass->OrderCart(session_id(), session_id(), 'del');
		break;
	case 'order_send':
		if ($_SESSION['login_user'] > 0){
			$shopcartclass->OrderCart($_SESSION['login_user'], session_id());
		} else {
			$err->AddError(1, "shopcart");
		}
		break;
	default:
		break;
}

?>
